package com.kgc.stuinfo.stuinfomanagerweb.controller;

import com.kgc.stuinfo.bean.Studentinfo;
import com.kgc.stuinfo.service.StuService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StuController {

    @Reference
    StuService stuService;

    @RequestMapping("/seleStu")
    public List<Studentinfo> seleStu(){
        return stuService.getAll();
    }

    @RequestMapping("/seleStuById")
    public Studentinfo seleStuById(Integer id){
        Studentinfo stuById = stuService.getStuById(id);
        return stuById;
    }


    @RequestMapping("/upStu")
    public String upStu(@RequestBody Studentinfo studentinfo){
        Integer integer = stuService.upStu(studentinfo);
        if(integer>0){
            return "SUCCESS";
        }
        return "FAIL";
    }
}
